<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of view
 * 
 * @author Subha Sundar Das (subhasundar.das@gmail.com)
 */
class View extends MY_Controller {

    //put your code here


    function view() {
        parent :: __construct();
        $this->load->model('pickup_model');
        $this->load->model('member_model');
        $this->load->model('management_model');
        $this->load->model('requirement_model');
        $this->load->model('location_model');
        $this->load->model('terms_model');
        $this->load->model('features_model');
        $this->load->model('specification_model');
    }

//--View Full detail of Veheicle (Seller)-------//    
    function detail() {
        $listing_id = intval($this->uri->segment(4));
        if ($listing_id) {

            $sql = "Select * from listing_master where id=$listing_id and status=51 limit 1";
            $listing = $this->db->query($sql)->row();
            $data['listing']['info'] = $this->listing_model->get_listing($listing_id);
            $data['listing']['photo'] = $this->terms_model->get_terms('listing-photo', $listing_id);
            $data['listing']['video'] = $this->terms_model->get_terms('listing-video', $listing_id);

            $data['member']['info'] = $this->member_model->get_member($data['listing']['info']->user);

            $this->template->title('title')
                    ->set_partial('header', 'header/header')
                    ->set_partial('customer_care', 'sidebar/customer_care')
                    ->set_partial('social_share', 'sidebar/social_share')
                    ->set_partial('search_reviews', 'sidebar/search_reviews')
                    ->set_partial('recent_news', 'sidebar/recent_news')
                    ->set_partial('recent_reviews', 'sidebar/recent_reviews')
                    ->set_partial('footer', 'footer/footer')
                    ->build('pages/view_detail', $data);
        }
    }

//--View detail News ----------//    
    function news($title = '', $id = 0) {
        if ($id) {
            $sql = "Select * from News where id=$id limit 1";
            $news = $this->db->query($sql)->row();

            $data['title'] = $news->title;
            $data['date'] = $news->date;
            $data['description'] = $news->description;
            $data['meta_title'] = $news->meta_title;
            $data['meta_description'] = $news->meta_description;
            $data['meta_keyword'] = $news->meta_keyword;

            $this->template->title($news->title)
                    ->set_partial('header', 'header/header')
                    ->set_partial('customer_care', 'sidebar/customer_care')
                    ->set_partial('social_share', 'sidebar/social_share')
                    ->set_partial('search_reviews', 'sidebar/search_reviews')
                    ->set_partial('recent_news', 'sidebar/recent_news')
                    ->set_partial('recent_reviews', 'sidebar/recent_reviews')
                    ->set_partial('footer', 'footer/footer')
                    ->build('pages/view', $data);
        }
    }

//--View Detail of Post Requirement ---(Subha-11/09/2012)---//
    function requirement($title = '', $id) {
        if ($id) {
            $data['post_requirement']['info'] = $this->requirement_model->get_requirement('CAR', $id);

            $this->template->set_layout('body_top');
            $this->template->title('title')
                    ->set_partial('header', 'header/header')
                    ->set_partial('recent', 'recent/post')
                    ->set_partial('customer_care', 'sidebar/customer_care')
                    ->set_partial('social_share', 'sidebar/social_share')
                    ->set_partial('search_reviews', 'sidebar/search_reviews')
                    ->set_partial('recent_news', 'sidebar/recent_news')
                    ->set_partial('recent_reviews', 'sidebar/recent_reviews')
                    ->set_partial('footer', 'footer/footer')
                    ->build('pages/post_requirement', $data);
        }
    }

//-- View full detail of Car Version ---//    
    function version($type = 'car', $title = '', $version_id = 0) {
        $sql = "Select * from Version where id=$version_id";
        $version = $this->db->query($sql)->row();

        $data['version']['features'] = $this->features_model->get_feature_master('CAR', $version_id);
        $data['version']['specifications'] = $this->specification_model->get_specification_master('CAR', $version_id);
        $data['version']['info'] = $version;
        
       //print_r($data['version']['specifications']);
       // die();
        
        
        $this->template->title($title)
                ->set_partial('header', 'header/header')
                ->set_partial('customer_care', 'sidebar/customer_care')
                ->set_partial('social_share', 'sidebar/social_share')
                ->set_partial('search_reviews', 'sidebar/search_reviews')
                ->set_partial('recent_news', 'sidebar/recent_news')
                ->set_partial('recent_reviews', 'sidebar/recent_reviews')
                ->set_partial('footer', 'footer/footer')
                ->build('pages/car_features', $data);
    }

}

?>
